package puppy.graph;


import org.apache.commons.collections15.Transformer;

import edu.uci.ics.jung.algorithms.scoring.util.VEPair;

/**
 * A <code>Transformer<VEPair,Number></code> that delegates its operation to a
 * <code>Transformer<E,Number></code>.  Mainly useful for technical reasons inside 
 * AbstractIterativeScorer; in essence it allows the edge weight instance 
 * variable to be of type <code>VEPair,W</code> even if the edge weight 
 * <code>Transformer</code> only operates on edges.
 */
public class DelegateToEdgeTransformerCustom<V,E> implements
        Transformer<VEPair<V,E>,Number>
{
	/**
	 * The transformer to which this instance delegates its function.
	 */
    protected Transformer<E,? extends Number> delegate;
    
    /**
     * Creates an instance with the specified delegate transformer.
     * @param edge_weights the Transformer to which this instance will delegate
     */
    public DelegateToEdgeTransformerCustom(Transformer<E, ? extends Number> edge_weights)
    {
        this.delegate = edge_weights;
    }
    
    /**
     * @see Transformer#transform(Object)
     */
    public Number transform(VEPair<V,E> arg0)
    {
    	
    	
    	
    //	System.out.println("Edge type:(in delegate after) + "+ edge.type + "\tnode_type(tag?):"+ node.isTag()) ;
        return delegate.transform((E) arg0.getE());
    }

	
}